<extend name="base/Base" />
<block name="Style">
<!-- FooTable Plugin CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/vendor/plugins/footable/css/footable.core.min.css">
		<!-- Admin Forms CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/assets/admin-tools/admin-forms/css/admin-forms.css">

	
		<js href="__ADDON__/ajaxupload/js/jquery.js" />
		<js href="__ADDON__/ajaxupload/js/ajaxupload.js" />
		<link rel="stylesheet" href="/public/addon/style/css/bootstrap-select.css">
		<script src="/public/addon/style/js/bootstrap-select.min.js"></script>
		<script type="text/javascript">
		$(function(){
		$("#upload_button2").hide();
		
			var button = $('#upload_button'), interval;
			var confirmdiv = $('#uploadphotoconfirm');
			var fileType = "pic",fileNum = "one"; 
			new AjaxUpload(button,{
				action: "__APP__/Home/Upload/Image/Addon/AjaxUpload.html",
				name: 'userfile',
				onSubmit : function(file, ext){
					if(fileType == "pic")
					{
						if (ext && /^(jpg|png|jpeg|gif|JPG)$/.test(ext)){
							this.setData({
								'info': '文件类型为图片'
							});
						} else {
							 confirmdiv.text('文件格式错误，请上传格式为.png .jpg .jpeg 的图片');
							return false;               
						}
					}
								
					confirmdiv.text('文件上传中');
					
					if(fileNum == 'one')
						this.disable();
					
					interval = window.setInterval(function(){
						var text = confirmdiv.text();
						if (text.length < 14){
							confirmdiv.text(text + '.');                    
						} else {
							confirmdiv.text('文件上传中');             
						}
					}, 200);
				},
				onComplete: function(file, response){
					if(response != "success"){
						if(response =='2'){
							confirmdiv.text("文件格式错误，请上传格式为.png .jpg .jpeg 的图片");
						}else{
							
							confirmdiv.text("上传完成");
							
							$("#newbikephotoName").val(response);
							$("#newbikephoto").attr("src",response);	
							$("#imgurl").attr("value",response);						
							
						}
						
					}
										  
					window.clearInterval(interval);
								
					this.enable();
					
					if(response == "success")
					alert('上传成功');              
				}
			});
		});
		
		$(function(){
			var button = $('#upload_button1'), interval;
			var confirmdiv = $('#uploadphotoconfirm1');
			var fileType = "pic",fileNum = "one"; 
			new AjaxUpload(button,{
				action: "__APP__/Home/Upload/Image/Addon/AjaxUpload.html",
				name: 'userfile',
				onSubmit : function(file, ext){
					if(fileType == "pic")
					{
						if (ext && /^(txt|doc|docx)$/.test(ext)){
							this.setData({
								'info': '文件类型为text或者word'
							});
						} else {
							 confirmdiv.text('文件格式错误，请上传格式为.txt .doc .docx 的文件');
							return false;               
						}
					}
								
					confirmdiv.text('文件上传中');
					
					if(fileNum == 'one')
						this.disable();
					
					interval = window.setInterval(function(){
						var text = confirmdiv.text();
						if (text.length < 14){
							confirmdiv.text(text + '.');                    
						} else {
							confirmdiv.text('文件上传中');             
						}
					}, 200);
				},
				onComplete: function(file, response){
				
					if(response != "success"){
						if(response =='2'){
							confirmdiv.text("文件格式错误，请上传格式为.png .jpg .jpeg 的图片");
						}else{
							
							confirmdiv.text("上传完成");
							
							$("#newbikephotoName1").val(response);
							$("#newbikephoto1").attr("src",response);	
							$("#imgurl1").attr("value",response);						
							
						}
						
					}
										  
					window.clearInterval(interval);
								
					this.enable();
					
					if(response == "success")
					alert('上传成功');              
				}
			});
		});
		
		$(function(){
			var button = $('#upload_button2'), interval;
			var confirmdiv = $('#uploadphotoconfirm2');
			var fileType = "pic",fileNum = "one"; 
			new AjaxUpload(button,{
				action: "__APP__/Home/Upload/Image/Addon/AjaxUpload.html",
				name: 'userfile',
				onSubmit : function(file, ext){
					if(fileType == "pic")
					{
						if (ext && /^(txt|doc|docx)$/.test(ext)){
							this.setData({
								'info': '文件类型为text或者word'
							});
						} else {
							 confirmdiv.text('文件格式错误，请上传格式为.txt .doc .docx 的文件');
							return false;               
						}
					}
								
					confirmdiv.text('文件上传中');
					
					if(fileNum == 'one')
						this.disable();
					
					interval = window.setInterval(function(){
						var text = confirmdiv.text();
						if (text.length < 14){
							confirmdiv.text(text + '.');                    
						} else {
							confirmdiv.text('文件上传中');             
						}
					}, 200);
				},
				onComplete: function(file, response){
					if(response != "success"){
						if(response =='2'){
							confirmdiv.text("文件格式错误，请上传格式为.png .jpg .jpeg 的图片");
						}else{
							
							confirmdiv.text("上传完成");
							
							$("#newbikephotoName2").val(response);
							$("#newbikephoto2").attr("src",response);	
							$("#imgurl2").attr("value",response);						
							
						}
						
					}
										  
					window.clearInterval(interval);
								
					this.enable();
					
					if(response == "success")
					alert('上传成功');              
				}
			});
			
			
		});
		</script>

</block>
<block name="Topbar">
								
 <!-- Start: Topbar -->
      <header id="topbar" class="ph10">
        <div class="topbar-left">
          <ul class="nav nav-list nav-list-topbar pull-left">
			<li  class=""  >
              <a href="__APP__/Admin/User/Create.html"    >新增用户</a>
            </li>
			<li  class="active"  >
              <a href="__APP__/Admin/User/Create.html"    >新增音乐人</a>
            </li>
			<li>
              <a  href="__APP__/Admin/User/Manage.html"   >用户管理</a>
            </li>
			<li>
              <a href="#" onclick="notice('用户管理中进行关联管理')"    >关联管理</a>
            </li>
          </ul>
        </div>
       <!--  <div class="topbar-right hidden-xs hidden-sm">
			<form class="form-inline" action="__APP__/XYZR/Database/MySQL/Backup.html" method="post">
			  <div class="form-group">
				<label for="exampleInputName2">开始时间</label>
				<input type="date" class="form-control" placeholder="请输入开始时间" name="begin_time" value='{$time|time|date="Y-m-d",###}'>
			  </div>
			  <div class="form-group">
				<label for="exampleInputEmail2">结束时间</label>
				<input type="date" class="form-control"  placeholder="请输入开始时间"  name="end_time" value='{$time|time|date="Y-m-d",###}' >
			  </div>
			  <button type="submit" class="btn btn-success">搜索记录</button>
			</form>
        </div>  -->
      </header>
	  						
    				
</block>
<block name="Content">

<!-- START ROW -->

	<div class="row">

		<!-- NEW COL START -->
		<article class="col-md-offset-1 col-sm-12 col-md-12 col-lg-10">
			
			<!-- Widget ID (each widget will need unique ID)-->
			<div class="jarviswidget" id="wid-id-7" data-widget-editbutton="false" data-widget-custombutton="false">
				<!-- widget options:
					usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
					
					data-widget-colorbutton="false"	
					data-widget-editbutton="false"
					data-widget-togglebutton="false"
					data-widget-deletebutton="false"
					data-widget-fullscreenbutton="false"
					data-widget-custombutton="false"
					data-widget-collapsed="true" 
					data-widget-sortable="false"
				-->
				

				<!-- widget div-->
				<div>
					
					<!-- widget edit box -->
					<div class="jarviswidget-editbox">
						<!-- This area used as dropdown edit box -->
						
					</div>
					<!-- end widget edit box -->
					
					<!-- widget content -->
					<div class="widget-body no-padding">
						
						<form id="smart-form-register" action="/"  enctype="multipart/form-data" method="post" class="smart-form">
							
							 <div class="form-group">
								<label for="exampleInputEmail1">请输入昵称</label>
								<input type="text" name="nickname" id="nickname"  class="form-control"  placeholder="请输入昵称" value="{$data.nickname}">
							  </div>
							    <div class="form-group">
								<label for="exampleInputEmail1">请输入手机号</label>
								<input  type="text" name="tel" id="tel"   class="form-control"  placeholder="请输入手机号" value="{$data.tel}">
							  </div>
							 <div class="form-group">
								<label for="exampleInputEmail1">请输入密码</label>
								<input type="text" name="password" id="password"  class="form-control"  placeholder="请输入密码" value="{$data.password}">
							  </div>
							  <div class="tab-box">
							  <label for="exampleInputEmail1">请选择性别</label>
							  <br/>
								<label class="radios">
									<input type="radio" checked name='sex' value="1">男
								</label>
								<label class="radios">
									<input type="radio" name='sex' value="2">女
								</label>
								<label class="radios">
									<input type="radio" name='sex' value="3">团体
								</label>
							  </div>
							  
							  <div class="form-group">
								<label for="exampleInputEmail1">请选择地区</label>
								<select class="form-control" name="country" id="country">
									<volist name="country_list" id="country_list">
									<option value ="{$country_list.id}">|-- {$country_list.name}</option>
									</volist>
								</select>
							 </div>
							  
							  <div class="form-group">
								<label for="exampleInputEmail1">请选择风格</label>
								 <select id="style" name="style_id[]" class="selectpicker show-tick form-control" multiple data-live-search="false">
									<volist name="style_list" id="style_list">
									<option value ="{$style_list.id}">{$style_list.name}</option>
									</volist>
								</select>
							 </div>
							 
							   <div class="form-group">
								<label for="exampleInputEmail1">请输入国籍</label>
								<input  type="text" name="native_place"  id="native_place"  class="form-control"  placeholder="请输入国籍" value="{$data.native_place}">
							  </div>
							  
							   <div class="form-group">
								<label for="exampleInputEmail1">请输入姓名</label>
								<input  type="text" name="name"  id="name"  class="form-control"  placeholder="请输入姓名" value="{$data.name}">
							  </div>
							   <div class="form-group">
								<label for="exampleInputEmail1">请输入身份证</label>
								<input  type="text" name="id_card"  id="id_card"  class="form-control"  placeholder="请输入身份证" value="{$data.email}">
							  </div>
							   <div class="form-group">
								<label for="exampleInputEmail1">请输入所属公司/厂牌</label>
								<input  type="text" name="province"  id="province"  class="form-control"  placeholder="请输入所属公司/厂牌" value="{$data.province}">
							  </div>
							   <div class="form-group">
								<label for="exampleInputEmail1">请输入介绍</label>
								<input  type="text" name="intro"  id="intro"  class="form-control"  placeholder="请输入介绍" value="{$data.intro}">
							  </div>
							  
							   <div class="form-group">
								<label for="exampleInputEmail1">请输入邮箱</label>
								<input  type="email" name="email"  id="email"  class="form-control"  placeholder="请输入邮箱" value="{$data.email}">
							  </div>
							 
							  
							 
							  
								<section>
									<label class="control-label" for="bike_type">&nbsp;</label>
									<input type="file" style="display:none" name="userfile">
									<input type="hidden" id="newbikephotoName" name="img" value="{$data.img}" />
									<input type="hidden" id="oldbikephotoName" value="" />
									<div class="controls" style="text-align:center;">
										<img  id="newbikephoto" src="{$data.img}" style="max-height:400px;" />
										<span class="help-inline"></span>
										<br>
										<div id="uploadphotoconfirm"></div>
										<br>
										<input type="hidden" name="img" id="imgurl" value="{$data.img}">
										<input type="button" class="btn btn-lg btn-primary" style="width:50%" id="upload_button"  value="上传头像" /><br/>
										
									</div>
								</section>
								
								<!-- <section>
									<label class="control-label" for="bike_type">&nbsp;</label>
									<input type="file" style="display:none" name="userfile">
									<input type="hidden" id="newbikephotoName1" name="text" value="{$data.text}" />
									<input type="hidden" id="oldbikephotoName1" value="" />
									<div class="controls" style="text-align:center;">
										<img  id="newbikephoto1" src="{$data.text}" style="max-height:400px;" />
										<span class="help-inline"></span>
										<br>
										<div id="uploadphotoconfirm1"></div>
										<br>
										<input type="hidden" name="text" id="imgurl1" value="{$data.text}">
										<input type="button" class="btn btn-lg btn-primary" style="width:50%" id="upload_button1"  value="上传文网文" /><br/>
										
									</div>
								</section> -->
								
							<div class="tab-box" id="changes">
							  <label for="exampleInputEmail1">独家协议是否签署或上传</label>
							  <br/>
								<label class="radios">
									<input type="radio" checked name='agreement_id' value="0">未签署
								</label>
								<label class="radios">
									<input type="radio" name='agreement_id' value="1">已签署
								</label>
								<label class="radios">
									<input type="radio" name='agreement_id' value="2">上传
								</label>
							  </div>
								<section>
									<label class="control-label" for="bike_type">&nbsp;</label>
									<input type="file" style="display:none" name="userfile">
									<input type="hidden" id="newbikephotoName2" name="agreement" value="{$data.agreement}" />
									<input type="hidden" id="oldbikephotoName2" value="" />
									<div class="controls" style="text-align:center;">
										<img  id="newbikephoto2" src="{$data.agreement}" style="max-height:400px;" />
										<span class="help-inline"></span>
										<br>
										<div id="uploadphotoconfirm2"></div>
										<br>
										<input type="hidden" name="agreement" id="imgurl" value="{$data.agreement}">
										<input type="button" class="btn btn-lg btn-primary" style="width:50%" id="upload_button2"  value="上传独家协议"/><br/>
										
									</div>
								</section>
							</fieldset>
							<br>
							<footer>
								
								<a onclick="change()" class="btn btn-primary" style="width:100%">
									新增用户
								</a>
							</footer>
						</form>						
						
					</div>
					<!-- end widget content -->
					
				</div>
				<!-- end widget div -->
				
			</div>
			<!-- end widget -->	

		</article>
		<!-- END COL -->

		
	<br>
	<br>
	</div>

	<!-- END ROW -->
	
</block>
<block name="Script">
	
  <!-- FooTable Plugin -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.all.min.js"></script> 
   <!-- FooTable Addon -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.filter.min.js"></script>

						<script>
							
							//新增配置   
							//新增配置
							function change(){  
							 
								var nickname = $("#nickname").val();    //昵称   
								var tel = $("#tel").val();              //手机号
								var password = $("#password").val();              //手机号
								var sex = $('input[name="sex"]:checked').val();			    //性别
								var country =  $("#country").val();		     //地区	
								var style = $("#style").val();         //风格
								var native_place = $("#native_place").val();         //国籍
								var name = $("#name").val();         //姓名
								var province = $("#province").val();         //所属公司/厂牌
								var intro = $("#intro").val();	            //介绍		
								var id_card = $("#id_card").val();	            //身份证		
								var email = $("#email").val();			
								var img = $("#newbikephotoName").val();
								var agreement_id = $('input[name="agreement_id"]:checked').val();	
								var renling = 0;
								//var text = $("#newbikephotoName1").val(); 
								var agreement = $("#newbikephotoName2").val();
								
								if(nickname == ''){
									layer.msg("昵称不能为空，请填写昵称"); 
									document.getElementById("nickname").focus();
									return false; 
								}
								if(style == null){
									layer.msg("请选择风格"); 
									
									return false; 
								}
								
								if(intro == ''){
									layer.msg("介绍不能为空，请填写介绍"); 
									document.getElementById("intro").focus();
									return false; 
								}
								if(tel != ''){
									if(password == ''){
										layer.msg("密码不能为空，请填写密码"); 
										document.getElementById("password").focus();
										return false; 
									}
								}else{
									renling = 1;
								}
								if(password != ''){
									if(tel == ''){
										layer.msg("手机号不能为空，请填写手机号"); 
										document.getElementById("tel").focus();
										return false; 
									}
								}
								
								$.ajax({
									type:'POST',
									url:"__APP__/Admin/User/Create.html",
									data:{
										"username": tel,
										"nickname": nickname,
										"sex": sex,
										"tel": tel,
										"password": password,
										"country": country,
										"native_place": native_place,
										"style": style,
										"name": name,
										"province": province,
										"intro": intro,
										"id_card": id_card,
										"email": email,
										"img": img,
										"agreement_id": agreement_id,
										"agreement": agreement,
										//"txt": text,
										"group_id": 9,
										"renling": renling,
										
									},
									success:function(data){
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
									},
									error:function(){
										layer.msg('系统繁忙,请稍候重试！');
									}
								
								});	 
							}
							
					
$("#changes label").click(function(){
$("#upload_button2").hide();
	var v = $(this).find("input").val();
	if(v==2){
		$("#upload_button2").show();
	}
})							
							</script>
 <script type="text/javascript">
  jQuery(document).ready(function() {

 

    // Init FooTable Examples
    $('.footable').footable();


  });
  </script>
</block>